﻿using Alison.EFCore.Dto;
using Alison.Service;
using Alison.Tools.HttpContact.Response;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Alison.API.Controllers
{
    /// <summary>
    /// 权限相关数据控制器
    /// </summary>
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class AuthItemController : ControllerBase
    {
        private readonly IAuthItemService _service;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="service"></param>
        public AuthItemController(IAuthItemService service)
        {
            this._service = service;
        }

        /// <summary>
        /// 获取所有功能按钮列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResponse> GetAll() => await _service.GetAll();

        /// <summary>
        /// 获取所有功能按钮列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResponse> GetAll([FromBody] AuthItemDto dto) => await _service.GetAll(dto);
    }
}
